#include <stdio.h>
#include <math.h>
#define N 10

double mysqrt(double y)
{
	double start = 0, end = y;
	double mid;
	int num =0;
	while(start <= end && num < 100)
	{
		mid = (start + end)/2;
		printf("%lf.\t",mid);
		double x = mid *mid - y;
		if(fabs(x) < 0.0001 )
			return mid;
		else if(x > 0)
			end = mid;
		else
			start = mid;
		num++;
	}
	return -1;
}

int main(void)
{
	double num = 1.0;
	printf("The sqrt of %lf is %lf.\n", num, mysqrt(num));
	return 0;
}
